Improve diagnostics and add code fixes for top-level await#36173
Improve diagnostics and add code fixes for top-level await#36173
Conversation
|
Looks like there's a merge conflict. @typescript-bot pack this |
|
Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at 80b065f. You can monitor the build here. It should now contribute to this PR's status checks. |
|
The message improvements look good. I would suggest always keeping the trailing comma to be honest - but I happen to be especially prone to adding new fields after members that lack a comma. |
|
@DanielRosenwasser: Trailing comma is illegal in JSON, so if we ever have a codefix that affects |
|
Would it be too much trouble to have the codefix check if it's in ES3 or working under JSON? |
|
or have the printer "do the right thing" under either mode? |
2ee66fd to
05a88f6
Compare
# Conflicts: # src/services/textChanges.ts
05a88f6 to
5963496
Compare
# Conflicts: # src/compiler/diagnosticMessages.json
ed5bcf9 to
2d80fed
Compare
|
I've updated it so that it only elides the trailing comma when the source file is a .json file (since there's no way to tell whether it's a normal .json or a non-standard .json like our tsconfig files). |
This improves the diagnostic messages for top-level
awaitand adds several code-fixes to improve the experience.In addition, this fixes a small bug in our
textChangesalgorithm to ensure we correctly add new-lines when inserting nodes at the top of a class body/object literal (and elide trailing commas in an object literal when they aren't needed.Fixes #36036
Fixes #36171